﻿<!--
Majesty of Omega - The next evolution of macro management space strategy

Copyright 2007 André Claaßen

This file is protected by the terms and conditions of the
Microsoft Community License (Ms-CL 1.1), a copy of which should
have been distributed along with this software. If not,
you may find the license information at the following URL:

http://www.microsoft.com/resources/sharedsource/licensingbasics/communitylicense.mspx
-->
    
<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:Generator="clr-namespace:Majesty_of_Omega.Logic.Generator;assembly=Majesty_of_Omega_BL"
	x:Class="Majesty_of_Omega.GUI.Pages.Game.Parts.RegionItemPart"
	x:Name="UserControl"
	Background="{DynamicResource PanelBackgroundBrush}" 
    MaxWidth="300"
    >

    <UserControl.Resources>
        <Style x:Key="RegioItemImageStyle" TargetType="{x:Type Image}">
            <Setter Property="Width" Value="24"/>
        </Style>

        <Style TargetType="{x:Type TextBlock}">
            <Setter Property="FontSize" Value="9" />
        </Style>

        <Style x:Key="InfoTextStyle" TargetType="{x:Type TextBlock}">
            <Setter Property="TextWrapping" Value="NoWrap"/>
            <Setter Property="TextTrimming" Value="None"/>
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="HorizontalAlignment" Value="Left" />
            <Setter Property="Margin" Value="4,0,4,0"  />
        </Style>
        <ObjectDataProvider x:Key="TestDataGeneratorDS" ObjectType="{x:Type Generator:TestDataGenerator}" />
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" DataContext="{Binding Path=TestRegion, Source={StaticResource TestDataGeneratorDS}}"  >
        <StackPanel Background="{x:Null}" HorizontalAlignment="Stretch" x:Name="StableIcon">
            <TextBlock FontWeight="Bold" x:Name="RegionTitle" Text="{Binding Path=RegionName}" TextWrapping="Wrap" Background="{DynamicResource SubTitelBrush}" Foreground="{DynamicResource TitelTextColor}" Padding="4,4,0,4"/>
    	<Grid>
    		<Grid.ColumnDefinitions>
    			<ColumnDefinition Width="40"/>
    			<ColumnDefinition Width="20"/>
    			<ColumnDefinition Width="*"/>
    			<ColumnDefinition Width="60"/>
    			<ColumnDefinition Width="20"/>
    		</Grid.ColumnDefinitions>
    		<Grid.RowDefinitions>
    			<RowDefinition Height="24" />
    			<RowDefinition Height="24" />
    		</Grid.RowDefinitions>

			<!-- Race Info -->
    		<Image Source="..\..\..\Graphics\Species\Kla.png"  Grid.Row="0" x:Name="RaceImage" Grid.RowSpan="2" Margin="4,-8,4,0" Width="30" />
    		<TextBlock Margin="0,0,0,0" VerticalAlignment="Bottom" Grid.Row="1" Text="Kla" FontSize="8" HorizontalAlignment="Center" />

			<!-- Icons -->
    		<Image Source="..\..\..\Graphics\UI\ico_fertility00.png" Grid.Column="1" Stretch="Uniform" Width="20" Height="20" x:Name="FertilityIcon"  />
    		<Image Source="..\..\..\Graphics\ui\ico_plnts_stable2.png" Grid.Row="1" Grid.Column="1" Stretch="None" Width="20" Height="20" />

			<!-- Context -->
    		<TextBlock FontWeight="Bold" Text="Lush" Grid.Column="2"  x:Name="LushText" Style="{DynamicResource InfoTextStyle}"  />
    		<TextBlock FontWeight="Bold" Text="Stable"  Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="4,0,4,0" Style="{DynamicResource InfoTextStyle}" />

    		<!-- Background-->
    		<Border Grid.Column="3" Grid.RowSpan="2">
    			<Image x:Name="BackgroundTerrainImage" Source="..\..\..\Graphics\PlanetStructure\MountainBackground.png" StretchDirection="Both" Stretch="UniformToFill" Width="Auto" Height="Auto"/>
    		</Border>
			
			<!-- Buttons -->
    		<Button Click="ViewRegionDetailButton_Click"   x:Name="ViewRegionDetailButton" Width="17.682" Content="&gt;&gt;" FontSize="9" HorizontalAlignment="Right" Margin="0,3.861,0,2" 
    			Grid.Column="4" Grid.RowSpan="2"/>
    	</Grid>
        
    	<Path Width="Auto" Height="1" Fill="#FFFFFFFF" Stretch="Fill" Stroke="#FF444444" StrokeThickness="1" Data="M24,128 L96,128" Style="{DynamicResource DividerPathStyle}"/>
        
        <TreeView 
				ItemsSource="{Binding Path=DeaList}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Grid.IsSharedSizeScope="False" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled"
			>
			<TreeView.Resources>
					<DataTemplate x:Key="ImprovementTemplate">
						<StackPanel>
				           <TextBlock Text="{Binding Path=Name}"/>
						 </StackPanel>
			        </DataTemplate>
				</TreeView.Resources>
                <TreeView.ItemTemplate>
                    <HierarchicalDataTemplate 
							ItemsSource="{Binding Improvements}"
							ItemTemplate="{StaticResource ImprovementTemplate}" 
							>
                        <Grid Width="Auto" Height="Auto" >
                    		<Grid.ColumnDefinitions>
                    			<ColumnDefinition Width="0.1*"/>
                    			<ColumnDefinition Width="0.3*"/>
                    			<ColumnDefinition Width="0.1*"/>
                    			<ColumnDefinition Width="0.1*"/>
                    			<ColumnDefinition Width="0.3*"/>
                    		</Grid.ColumnDefinitions>
                    		<Image Source="{Binding Path=DeaTypeInfoBlock.DeaIconUri, Converter={StaticResource UriToImageConverter}}" Margin="0,0,0,0" Stretch="None" />
                    		<TextBlock Text="{Binding Path=DeaTypeInfoBlock.Label}" Grid.Column="1" VerticalAlignment="Center" Margin="4,0,4,0" />
                    		<Image Source="..\..\..\Graphics\UI\ico_plnts_cement.png" Grid.Column="2" Stretch="None" />
                    		<TextBlock Grid.Column="3" Text="+16" Margin="4,0,4,0"  />
                    		<ProgressBar Grid.Column="4" Orientation="Vertical" HorizontalContentAlignment="Stretch" Width="14" Value="50" Margin="0,2,0,2" BorderBrush="#FF000000" Background="#FF000000" />
                    	</Grid>
                    </HierarchicalDataTemplate>
                </TreeView.ItemTemplate>
			</TreeView>
            
        <!-- The following listbox shows all DEAs of the region -->
	    <!--<ListBox HorizontalAlignment="Stretch"
	             x:Name="DeaListBox"
	             HorizontalContentAlignment="Stretch" 
                 VerticalContentAlignment="Top" 
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                 ItemsSource="{Binding Path=Region.DeaList}"
                 Height="Auto" Background="{x:Null}" Margin="0,1,0,0" >
				<ListBox.ItemTemplate>
					<DataTemplate>
					    	<Grid Width="Auto" Height="24" VerticalAlignment="Center" HorizontalAlignment="Stretch" >
					    		<Grid.ColumnDefinitions>
					    			<ColumnDefinition Width="0.1*"/>
					    			<ColumnDefinition Width="0.3*"/>
					    			<ColumnDefinition Width="0.1*"/>
					    			<ColumnDefinition Width="0.1*"/>
					    			<ColumnDefinition Width="0.3*"/>
					    		</Grid.ColumnDefinitions>
					    		<Image Source="{Binding Path=DeaTypeInfoBlock.DeaIconUri, Converter={StaticResource UriToImageConverter}}" Margin="0,0,0,0" Stretch="None" />
					    		<TextBlock Text="{Binding Path=DeaTypeInfoBlock.Label}" Grid.Column="1" VerticalAlignment="Center" Margin="4,0,4,0" />
					    		<Image Source="..\..\..\Graphics\UI\ico_plnts_cement.png" Grid.Column="2" Stretch="None" />
					    		<TextBlock Grid.Column="3" Text="+16" Margin="4,0,4,0"  />
								<ProgressBar Grid.Column="4" Orientation="Vertical" HorizontalContentAlignment="Stretch" Width="14" Value="50" Margin="0,2,0,2" BorderBrush="#FF000000" Background="#FF000000" />
					    	</Grid>
					</DataTemplate>
				</ListBox.ItemTemplate>			 
	    </ListBox>-->
	    <!-- <Path Width="300" Height="1" Fill="#FFFFFFFF" Stretch="Fill" Stroke="#FF444444" StrokeThickness="1" Data="M24,128 L96,128" Style="{DynamicResource DividerPathStyle}"/> -->
	    <Path Width="300" Style="{DynamicResource DividerPathStyle}"/>
		</StackPanel>
    </Grid>
</UserControl>
